﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PhoobearLibs.Resource.Resx
{
    
    public abstract class ResourceOperationEventArgs<TValue> : EventArgs
    {
        public Resource<TValue> Resource { get; set; }
        public string Key { get; set; }

        public override string ToString()
        {
            return string.Format("[{0}]", this.Resource.ToString());
        }

        public string ToString(string opname)
        {
            return string.Format("{0} {1} : {2}", this.ToString(), opname, this.Key);
        }
    }
    
    public class AddResourceOperationEventArgs<TValue> : ResourceOperationEventArgs<TValue>
    {
        public TValue Value { get; set; }

        public override string ToString()
        {
            return string.Format("{0}\t{1}", base.ToString("추가"), this.Value);
        }
    }

    public class RemoveResourceOperationEventArgs<TValue> : ResourceOperationEventArgs<TValue>
    {
        public TValue Value { get; set; }

        public override string ToString()
        {
            return string.Format("{0}\t{1}", base.ToString("삭제"), this.Value);            
        }
    }

    public class UpdateResourceOperationEventArgs<TValue> : ResourceOperationEventArgs<TValue>
    {
        public TValue OldValue { get; set; }
        public TValue NewValue { get; set; }

        public override string ToString()
        {
            return string.Format("{0}\t{1} -> {2}", base.ToString("변경"), this.OldValue, this.NewValue);
        }
    }

    public class ErrorResourceOperationEvenrArgs<T> : ResourceOperationEventArgs<T>
    {
        public Exception Exception { get; set; }
        public string Message { get; set; }

        public override string ToString()
        {
            return string.Format("{0} {1}\n{2}", base.ToString("에러"), this.Message, this.Exception.ToString());
        }

    }
}
